<template>
  <div class="radio-container">
    <a-radio-group v-model="radioValue" v-bind="$attrs">
      <a-radio v-for="item in options" :key="item.value" :value="item.value">
        {{ item.label }}
      </a-radio>
    </a-radio-group>
  </div>
</template>

<script>
export default {
  name: "VRadio",
  model: {
    /*
     :value="xxx"
     @input="$emit('change1', $event.target.value)"
    */
    // 默认 将 value 改为 -- > xxx
    // prop: 'value',
    // 默认将 input 改为 change
    event: "change",
  },
  props: {
    options: {
      type: Array,
      default: () => [],
    },
    value: {
      type: [String, Number, Boolean],
    },
  },
  computed: {
    radioValue: {
      get() {
        return this.value;
      },
      set(val) {
        this.$emit("change", val);
      },
    },
  },
};
</script>

<style></style>
